package com.linwen.excise.leetcode;

/**
 * @ClassName _226反转二叉树
 * @Description TODO
 * @Author zero
 * @DATE 2024/4/28 2:37 AM
 * @Version 1.0
 */
public class _226反转二叉树 {
    public static void main(String[] args) {

    }

    public static TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);
        root.left = right;
        root.right = left;
        return root;
    }
}
